package Demo1;


class Dog extends Animal{
    @Override
    public void Bark() {
        System.out.println("小狗在汪汪叫");
    }
}
abstract class Animal{
    public abstract void Bark();
}
class Cat extends Animal{
    @Override
    public void Bark() {
        System.out.println("小猫在喵喵叫");//重写抽象方法
    }
}
public class Test {
    public static void main(String[] args) {
        Dog dog=new Dog();
        func(dog);
        Cat cat=new Cat();
        func(cat);
    }
    public static void func(Animal animal){
        animal.Bark();
    }
}
